Ext.define('Admin.view.leave.LeaveAddForm', {
    extend: 'Ext.form.Panel',
    alias: 'widget.leave-add-form',
    requires: [
        'Ext.button.Button',
        'Ext.form.field.*'
        //'Ext.form.field.File',
        //'Ext.form.field.Date',
        //'Ext.form.field.ComboBox',
        //'Ext.form.field.HtmlEditor'
    ],
    viewModel: {type: 'leave'},
    controller: 'leave',
    bodyPadding: 10,
    bodyBorder: true,


    defaults: {
        anchor: '100%'
    },
    fieldDefaults: {
        labelAlign: 'left',
        msgTarget: 'none',
        invalidCls: '' //unset the invalidCls so individual fields do not get styled as invalid
    },

    items: [{
        xtype: 'textfield',
        name: 'userId',
        fieldLabel: '请假人',
        value:loginUser,
        editable:false,
        allowBlank: false
    }, {
        xtype: 'combobox',
        name: 'leaveType',
        fieldLabel: '请假类型',
        //vtype: 'email',
        store: Ext.create('Ext.data.Store', {
		    fields: ['value', 'name'],
		    data : [
		        {"value":"A", "name":"请假"},
		        {"value":"B", "name":"休假"}
		    ]
		}),
	    queryMode: 'local',
	    displayField: 'name',
	    valueField: 'value',
        allowBlank: false
	},{
		xtype: 'datefield',
	    fieldLabel: '假期开始时间',
	    format: 'Y/m/d H:i:s', 
	    name: 'startTime'
	    //,id: 'startdt',
	    //vtype: 'daterange',
	    //endDateField: 'enddt' // id of the end date field
	},{
		xtype: 'datefield',
	    fieldLabel: '假期结束时间',
	    format: 'Y/m/d H:i:s', 
	    name: 'endTime'
	    //,id: 'enddt',
	    //vtype: 'daterange',
	    //startDateField: 'startdt' // id of the start date field
	}
    ,{
        xtype     : 'textareafield',
        grow      : true,
        name      : 'reason',
        fieldLabel: '请假原因',
        anchor    : '100%'
    }],

   	bbar: ['->',{
		xtype: 'button',
		ui: 'soft-green',
		text: '提交'	,
		handler: 'onClickAddFormSubmitButton'
	},{
		xtype: 'button',
		ui: 'gray',
		text: '取消',
		handler:function(btn){
			var win = btn.up('window');
	        if (win) {
	            win.close();
	        }
		}
	},'->']


});